package com.woniuxy.core.model;

import lombok.Data;

@Data
public class Result<T>{
    private String msg;
    private Integer code;
    private Boolean flag;
    private T data;

    public static  <S> Result<S> success(String msg,S data){
        Result<S> result = new Result<>();
        result.setCode(200);
        result.setFlag(true);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

    public static  <S> Result<S> success(String msg){
        Result<S> result = new Result<>();
        result.setCode(200);
        result.setFlag(true);
        result.setMsg(msg);
        return result;
    }

    public static  Result<?> fail(Integer code,String msg){
        Result<?> result = new Result<>();
        result.setCode(code);
        result.setFlag(false);
        result.setMsg(msg);
        return result;
    }

//    public static <S> Result<Collection<S>> success(String msg,Class<S> type,Collection<S> data){
//
//        Result<Collection<S>> result = new Result<>();
//        result.setCode(200);
//        result.setFlag(true);
//        result.setMsg(msg);
//        result.setData(data);
//        return result;
//    }



}
